﻿using Bmz.IM.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bmz.IM.AccessDB
{
    public class FriendAccess
    {
        private List<FriendPO> friends { get; set; }
        public FriendAccess()
        {
            friends = new List<FriendPO>();
            friends.Add(new FriendPO() { 
                Id=1,
                UserId="zhangxl",
                FriendId="zhangk",
                Folder="pengyou",
                IsActive=true,
            });
            friends.Add(new FriendPO()
            {
                Id = 2,
                UserId = "zhangxl",
                FriendId = "niex",
                Folder = "haojiyou",
                IsActive = true,
            });
            friends.Add(new FriendPO()
            {
                Id = 3,
                UserId = "zhangk",
                FriendId = "zhangxl",
                Folder = "同学",
                IsActive = true,
            });
            friends.Add(new FriendPO()
            {
                Id = 4,
                UserId = "niex",
                FriendId = "zhangxl",
                Folder = "tongshi",
                IsActive = true,
            });
            friends.Add(new FriendPO()
            {
                Id = 5,
                UserId = "niex",
                FriendId = "zhangk",
                Folder = "tongshi",
                IsActive = true,
            });
            friends.Add(new FriendPO()
            {
                Id =6,
                UserId = "zhangk",
                FriendId = "niex",
                Folder = "tongshi",
                IsActive = true,
            });
            friends.Add(new FriendPO()
            {
                Id = 5,
                UserId = "xiongzy",
                FriendId = "zhangxl",
                Folder = "tongshi",
                IsActive = true,
            });
            friends.Add(new FriendPO()
            {
                Id = 5,
                UserId = "zhangxl",
                FriendId = "xiongzy",
                Folder = "tongshi",
                IsActive = true,
            });
        }

        public List<FriendPO> GetListByUserId(string userId)
        {
            var query = from p in friends
                        where p.UserId == userId && p.IsActive==true
                        select p;
            return query.ToList();
        }

    }
}
